package com.zhupanlin.zhyl.msm.controller;

import com.zhupanlin.zhyl.common.result.Result;
import com.zhupanlin.zhyl.msm.service.MsmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhupanlin
 * @version 1.0
 * @description: TODO
 * @date 2024/12/1 15:11
 */
@RestController
@RequestMapping("/api/msm")
public class MsmApiController {

    @Autowired
    private MsmService msmService;

    @GetMapping("send/{phone}")
    public Result sendCode(@PathVariable("phone") String phone) {
        boolean flag = msmService.sendCode(phone);
        if (flag) {
            return Result.ok();
        } else {
            return Result.fail("短信发送失败");
        }
    }

}
